﻿@model YouWei.Infrastructure.Entity.CarlifeActivity
@{
    ViewBag.Title = "短信活动";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<section class="content-header">
    <h1>
        活动管理
        <small></small>
    </h1>
    <ol class="breadcrumb">
        <li><a href="#"><i class="fa fa-dashboard"></i>主页</a></li>
        <li class="active">活动列表</li>
    </ol>
</section>
<section class="content">
    <div class="row">
        <div class="col-md-12">
            <div class="box box-primary">
                <div class="box-header">
                </div>
                <!-- /.box-header -->
                <div class="box-body table-responsive no-padding">
                    <form class="form-horizontal" enctype="multipart/form-data" method="post" action="@Url.Action("Save","ActivityMessage")">
                        <div class="box-body">
                            <input type="hidden" name="ID" value="@Model.ID" />
                            <div class="form-group">
                                <label class="col-sm-2 control-label">页头图片</label>
                                <div id="HeadImageUrl" class="col-sm-10 dm-uploader">
                                    <img class="img-rounded" alt="140x140" src="@Model.HeadImageUrl" data-holder-rendered="true" style="width: 140px; height: 140px;">
                                    <div role="button" class="btn btn-primary mr-2">
                                        <i class="fa fa-fw fa-folder-o"></i>图片上传
                                        <input type="file" title="Click to add Files">
                                    </div>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">车型</label>
                                <div class="col-sm-10">
                                    <input type="text" name="CarName" value="@Model.CarName" class="form-control" placeholder="丰田RAV4">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">车型简称</label>
                                <div class="col-sm-10">
                                    <input type="text" name="CarShortName" value="@Model.CarShortName" class="form-control" placeholder="RAV4">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">欢迎语</label>
                                <div class="col-sm-10">
                                    <input type="text" name="WelContent" value="@Model.WelContent" class="form-control" placeholder="北京丰田RAV4车友群">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">话术</label>
                                <div class="col-sm-10">
                                    <textarea rows="8" name="WelDetail" class="form-control" placeholder="RAV4"> @Model.WelDetail </textarea>

                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">群主微信号</label>
                                <div class="col-sm-10">
                                    <input type="text" value="@Model.WxCode" name="WxCode" class="form-control" placeholder="RAV4">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">群主二维码</label>
                                <div class="col-sm-10">
                                    <img class="img-rounded" alt="140x140" src="@Model.WxQRImageUrl" data-holder-rendered="true" style="width: 140px; height: 140px;">
                                    <input type="file" name="WxQRImageUrl" accept=".png, .jpg, .jpeg" class="form-control">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">活动图1</label>
                                <div class="col-sm-10">
                                    <img class="img-rounded" alt="140x140" src="@Model.Image1Url" data-holder-rendered="true" style="width: 140px; height: 140px;">
                                    <input type="file" name="Image1Url" accept=".png, .jpg, .jpeg" class="form-control">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">活动图2</label>
                                <div class="col-sm-10">
                                    <img class="img-rounded" alt="140x140" src="@Model.Image2Url" data-holder-rendered="true" style="width: 140px; height: 140px;">
                                    <input type="file" name="Image2Url" accept=".png, .jpg, .jpeg" class="form-control">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">活动图3</label>
                                <div class="col-sm-10">
                                    <img class="img-rounded" alt="140x140" src="@Model.Image3Url" data-holder-rendered="true" style="width: 140px; height: 140px;">
                                    <input type="file" name="Image3Url" accept=".png, .jpg, .jpeg" class="form-control">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label">活动图4</label>
                                <div class="col-sm-10">
                                    <img class="img-rounded" alt="140x140" src="@Model.Image4Url" data-holder-rendered="true" style="width: 140px; height: 140px;">
                                    <input type="file" name="Image4Url" accept=".png, .jpg, .jpeg" class="form-control">
                                </div>
                            </div>
                        </div>
                        <!-- /.box-body -->
                        <div class="box-footer text-center">
                            <button type="submit" class="btn btn-info">保存</button>
                        </div>
                        <!-- /.box-footer -->
                    </form>
                </div>
                <div class="box-footer clearfix ">
                </div>
                <!-- /.box-body -->
                <!-- /.box -->
            </div>
        </div>
    </div>
</section>
@section scriptsBottom{
    <script type="text/javascript">

        $('#HeadImageUrl').dmUploader({ //
            url: '@Url.Action("UploadImage", "ActivityMessage")',
            maxFileSize: 3000000, // 3 Megs max
            multiple: false,
            allowedTypes: 'image/*',
            extFilter: ['jpg', 'jpeg', 'png', 'gif'],
            onInit: function () {
            },
            onComplete: function (res) {
                console.log(res)
            },
            onNewFile: function (id, file) {
                if (typeof FileReader !== "undefined") {
                    var reader = new FileReader();
                    var img = this.find('img');

                    reader.onload = function (e) {
                        img.attr('src', e.target.result);
                    }
                    reader.readAsDataURL(file);
                }
            }
        });

    </script>
    }
